package com.xbb.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import com.xbb.entity.Statistics;
import com.xbb.mapper.CategoryMapper;
import com.xbb.entity.Category;
import com.xbb.service.CategoryService;
import org.springframework.stereotype.Service;

@Service
public class CategoryServiceImpl implements CategoryService {

    @Resource
    private CategoryMapper categoryMapper;

    // 删除数据
    @Override
    public int deleteByPrimaryKey(Integer id) {
        return categoryMapper.deleteByPrimaryKey(id);
    }

    // 插入数据
    @Override
    public int insert(Category category) {
        return categoryMapper.insert(category);
    }

    // 插入数据
    @Override
    public int insertSelective(Category category) {
        return categoryMapper.insertSelective(category);
    }

    // 根据ID查询单个数据
    @Override
    public Category selectByPrimaryKey(Integer id) {
        return categoryMapper.selectByPrimaryKey(id);
    }

    // 修改数据
    @Override
    public int updateByPrimaryKeySelective(Category category) {
        return categoryMapper.updateByPrimaryKeySelective(category);
    }

    // 修改数据
    @Override
    public int updateByPrimaryKey(Category category) {
        return categoryMapper.updateByPrimaryKey(category);
    }

    // 根据条件查询分页数据
    @Override
    public List<Category> selectListByPaging(Integer page, Integer limit,String name) {
        return categoryMapper.selectListByPaging(
            (page - 1) * limit,
            limit,
            name
        );
    }

    // 根据条件查询数据条数
    @Override
    public int selectCountByPaging(String name) {
        return categoryMapper.selectCountByPaging(
            name
        );
    }

    // 查询全部数据
    @Override
    public List<Category> selectAll() {
        return categoryMapper.selectAll();
    }

    // 根据条件查询列表数据
    @Override
    public List<Category> selectList(Category category) {
        return categoryMapper.selectList(category);
    }

    // 根据字段、排序方式、limit条 查询列表数据
    @Override
    public List<Category> selectListByLimit(String field, String sort, Integer limit) {
        return categoryMapper.selectListByLimit(field, sort, limit);
    }

    // 根据字段查询列表数据
    @Override
    public List<Category> selectListByField(String field, Object value) {
        return categoryMapper.selectListByField(field, value);
    }

    // 根据条件查询单个数据
    @Override
    public Category selectOne(Category category) {
        return categoryMapper.selectOne(category);
    }

    // 根据ID查询详情数据
    @Override
    public Category selectOneByDetails(Integer id) {
        return categoryMapper.selectOneByDetails(id);
    }

    // 查询全部条数
    @Override
    public int selectAllCount() {
        return categoryMapper.selectAllCount();
    }

    // 根据条件查询数据条数
    @Override
    public int selectCount(Category category) {
        return categoryMapper.selectCount(category);
    }

    // 根据条件修改全部数据
    @Override
    public int updateAll(Category category) {
        return categoryMapper.updateAll(category);
    }

    @Override
    public List<Statistics> selectStatisticsBySalesVolume() {
        return categoryMapper.selectStatisticsBySalesVolume();
    }
}
